package com.ylq.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

public class StudentDemo {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        HashMap<String, List<String>> map = new HashMap<>();
        for (int i = 0; i < 3; i++) {
            System.out.println("姓名：");
            String name = scanner.nextLine();
            System.out.println("年龄：");
            System.out.println(name);
            String age = scanner.nextLine();
            System.out.println("性别：");
            String sex = scanner.nextLine();

            ArrayList<String> student = new ArrayList<>();
            student.add(name);
            student.add(age);
            student.add(sex);
            map.put(name,student);
        }

        System.out.println("请输入要查找的学生名称：");
        String name = scanner.nextLine();
        List<String> strings = map.get(name);
        System.out.println("姓名："+strings.get(0)+"，年龄："+strings.get(1)+"，性别："+strings.get(2));
    }
}
